package com.zp.utils;

import com.zp.common.Result;
import com.zp.common.ResultEnum;

public class ResultUtil {

    public static Result success(Object data){
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(data);
        return result;
    }

    public static Result success(){
        return success(null);
    }

    public static Result error(String msg) {
        return new Result(400,msg);
    }

    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

}
